package com.fowo.api.controller.shipment.wfs;

import com.fowo.api.model.logistics.reconciliation.LogisticsReconciliationReductiondataAction;
import com.fowo.api.model.logistics.reconciliation.LogisticsReconciliationVo;
import com.fowo.api.service.impl.LogisticsReconciliationServiceImpl;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.Resource;
import java.util.List;

@Component
public class logisticsReconciliationReductiondataAction implements LogisticsReconciliationReductiondataAction {
    @Resource
    private LogisticsReconciliationServiceImpl logisticsReconciliationService;

    @Override
    public void run(List<Long> idList) throws Exception {
        for (Long id : idList) {
            reductiondata(id);
        }
    }

    //还原
    private void reductiondata(Long id) throws Exception {
        LogisticsReconciliationVo voById = logisticsReconciliationService.getVoById(id);
        Assert.notNull(voById,"物流对账单不存在");
        voById.setState("0");
        logisticsReconciliationService.updateById(voById);

    }
}
